<?php
global $wpdb;
$view = $_GET['view'];
$url = get_bloginfo('home')."/wp-admin/admin.php?page=hotel-setting&action=hotel-booked&update=";
$order = db_select_data_by_int("orders", "ID", $view);

$customerID	= $order[0]->customerID;
$itemID	= $order[0]->itemID;
$paymentID  = $order[0]->paymentID;

$customers = db_select_data_by_int("customers", "ID", $customerID); 
$hotel = db_select_data_by_int("hotels", "ID", $itemID); 
$payment = db_select_data_by_int("payments", "ID", $paymentID);
 //print_r($hotel);
?>
<div class="view-booking-detail">
	<h1>Hotel Booked Infomation</h1>
	<table>
		<tr>
			<td class="booked-title">Booked ID</td>
			<td class="booked-item"><span><?php echo $order[0]->ID;?></span></td>
			
			<td class="booked-title">Date</td>
			<td class="booked-item"><span><?php echo $order[0]->date;?></span></td>
		</tr>
		<tr>
			<td class="booked-title">Order Status</td>
			<td class="booked-item"><span><?php echo $order[0]->orderStatus;?></span></td>
			<td class="booked-title">Payment Status</td>
			<td class="booked-item"><span><?php echo $payment[0]->paymentStatus;?> <?php echo ' - '.$payment[0]->paymentMethod;?></span></td>
			
		</tr>		
		<tr>
			<td class="booked-title">Hotel</td>
			<td class="booked-item"><span><?php echo get_the_title($hotel[0]->hotelID);?></span></td>			
		</tr>
		<tr>
			<td class="booked-title">Address</td>
			<td class="booked-item"><span><?php echo get_post_meta($hotel[0]->hotelID,$wpdb->prefix.'address',true);?></span></td>
			
			<td class="booked-title">Rating</td>
			<td class="booked-item"><span><?php echo get_post_meta($hotel[0]->hotelID,$wpdb->prefix.'rating',true);?></span></td>
		</tr>
		<tr>
			<td class="booked-title">Type Room</td>
			<td class="booked-item"><span><?php echo db_get_name_type_room($hotel[0]->typeRoom);?></span></td>			
		</tr>
		<tr>
			<td class="booked-title">Max</td>
			<td class="booked-item"><span><?php echo $hotel[0]->max;?></span></td>
			
			<td class="booked-title">Number of Room</td>
			<td class="booked-item"><span><?php echo $hotel[0]->numberOfroom;?></span></td>
		</tr>
	
		<tr>
			<td class="booked-title">Check in date</td>
			<td class="booked-item"><span><?php echo $hotel[0]->checkIn;?></span></td>
			
			<td class="booked-title">Check out date</td>
			<td class="booked-item"><span><?php echo $hotel[0]->checkOUT;?></span></td>
		</tr>
		<tr>
			<td class="booked-title">Hotel Price</td>
			<td class="booked-item"><span><?php echo $payment[0]->price;?> USD</span></td>
			
			<td class="booked-title">Deposit</td>
			<td class="booked-item"><span><?php echo $payment[0]->paymentCurrent;?> USD</span></td>
		</tr>
		
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item"><h2>Customer Infomation</h2></td>
		</tr>
		<tr>
			<td class="booked-title">Customer Name</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerName;?></span></td>
			
			<td class="booked-title">Customer Address</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerName;?></span></td>
		</tr>
		
		<tr>
			<td class="booked-title">Customer Email</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerEmail;?></span></td>
			
			<td class="booked-title">Customer Phone</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerPhone;?></span></td>
		</tr>
		
		<tr>
			<td class="booked-title">Customer Comment</td>
			<td class="booked-item"><span><?php echo $customers[0]->customerComment;?></span></td>
		</tr>
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item"></td>
		</tr>
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item">
				<a id="update_button" href="<?php echo $url;?><?php echo $order[0]->ID;?>">Update</a>
			</td>
		</tr>
		<tr>
			<td class="booked-title"></td>
			<td class="booked-item"></td>
		</tr>
	</table>		
</div>
